/**
 * Created by zhulingxiao on 2017/6/7.
 */
import {myFetch} from '../../utils/func'
import {tableLoading, tableFinish} from './table'

export const USER_UPDATE = 'USER_UPDATE';

export const userFetch = (cb) => {

    return dispatch => {
        dispatch(tableLoading());
        return myFetch('/api/v1/user/list.php')

            .then(data => {

                dispatch({type: USER_UPDATE, data: data.data});
                dispatch(tableFinish());
                cb(data);

            })

    }

};


